As described in Variables, variables are associated with (assigned) a value. This value can also be modified at any point during execution of your scripts. Both these operations are performed using the assignment operator.
The := operator expects the first (left-hand) operand to be a variable, array, element, or vector field/structure member. The second (right-hand) operand can be an arbitrary value of any type, though the value must be compatible with the data type of the first operand. The value of the expression is the value of the right-hand operand.
As mentioned in Arrays in VectorScript, array elements are accessed using square brackets
[ ], along with the positional index of the value to be retrieved. This bracket pair is treated as an operator in VectorScript.
The [ ] operator uses as the name of an array as its first operand (to the left of the brackets). The second operand, which goes between the brackets, can be any expression which evaluates to an
INTEGER value.
If the array specified as the first operand is two-dimensional, the array access operator requires a third operand, which also goes between the brackets. In this case, both the second and third operands (which are separated by a comma) may be any expression evaluating to an
INTEGER value.
will evaluate to the value in the third element of the price array. For a two dimensional array
plant_data, the expression
will evaluate to the value contained in the element specified by [2,i+4]. The expression
i+4 must evaluate to an
INTEGER value in order to be used as an operand in the expression.
The . operator in VectorScript is a specialized operator that allows you to directly access values contained within certain data types, notably vectors and structures.
The . operator requires a vector or structure as its first (left) operand. The second operand, unlike most operators, must be either a vector field or structure member name; no expressions are allowed. Vector field identifiers must be one of the three valid vector field names— x, y, or z. Structure member names should correspond to a valid member in the structure type declaration.
will evaluate to the value in the x field of the vector
distance_vector1. When dealing with a structure, the expression